﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class 管理员_登录_删除 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        {
            BindDate();
        }
    }
    protected void BindDate()
    {
        Car_users tmp = new Car_users();
        gridview.DataSource = tmp.getallusers().Tables[0].DefaultView;
        gridview.DataBind();
    }
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        string number = gridview.DataKeys[e.RowIndex].Value.ToString().Trim();

        Car_users tmp = new Car_users();
        tmp.number = number;
        tmp.delete(tmp);
        BindDate();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if(e.Row.RowType==DataControlRowType.DataRow)
        {
            try
            {

                //获取删除按钮
                LinkButton lnkbtnDelete = (LinkButton)e.Row.Cells[7].Controls[0];
                //实现客户端信息显示
                lnkbtnDelete.OnClientClick = "return confirm('你真的要删除" + e.Row.Cells[1].Text + "吗？')";
            }
            catch
            {

            }
        }
    }
}